//
//  HomeViewController.swift
//  JiaXiaoTong
//
//  Created by leo on 2018/2/25.
//  Copyright © 2018年 IT. All rights reserved.
//

import UIKit

class HomeViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
    lazy var tableView:UITableView = {
    let frame =   CGRect(x: 0, y: 64, width: TPWidth, height: TPHeight)
      let tableview =  UITableView.init(frame: frame, style:.plain)
        tableview.delegate = self
        tableview.dataSource = self
//        self.tableView.tableFooterView = [[UIView alloc] init];
//        self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewStudent)];
//        [self.view addSubview:self.tableView];
//        [self beginMyRefreshing];
//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(beginMyRefreshing) name:@"beginMyRefreshing" object:nil];
//
//        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(beginMyRefreshing) name:kNotificationParentsAnnouncement object:nil];
      tableview.tableFooterView = UIView()
        tableview.mj_header = MJRefreshNormalHeader.init(refreshingTarget: self, refreshingAction: Selector(("loadNewStudent")))
       
        return tableview
    }()
    func beginMyRefreshing(){
        self.tableView.mj_header.beginRefreshing()
    }
   
    func loadNewStudent(){
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        self.setUpControllerView()
  print(LoginViewMode.shareUserLogin.userInfoPath)
   
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
extension HomeViewController {

    func setUpControllerView(){
     
        self.title = getLanguageManageKey(key:"Class")
       
        self.view.addSubview(tableView)
        NotificationCenter.default.addObserver(self, selector:Selector(("beginMyRefreshing")) , name: NSNotification.Name(rawValue: "beginMyRefreshing"), object: nil)
        NotificationCenter.default.addObserver(self, selector: Selector(("beginMyRefreshing")), name: NSNotification.Name(rawValue: kNotificationParentsAnnouncement), object: nil)
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 2
    }
    func numberOfSections(in tableView: UITableView) -> Int {
        return 2 ;
    }
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 90
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
//        HomeCell *cell = [HomeCell cellWithTableView:tableView];
//        cell.course = self.classCourseList[indexPath.row];
//        return cell;
      // HomeCell.biccellWithTableView(tableView)
        let cell =  HomeCell.biccellWithTableView(tableview: tableView)
        
        guard cell != nil else {

        return UITableViewCell()
        }
        return cell!
    }
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        
    }
    func setBadgeValue(){
        
        
    }
    
    
}
